import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

public class Test2 {
    public static void main(String[] args){
        ArrayList<Student> list=new ArrayList<>();
        Collections.addAll(list,new Student(23,"zhangsan"),new Student(21,"lisi"),new Student(27,"wangwu"));
       //调用成员方法有两种方式
        //对象：：方法名
        //类名：：方法名
//        /*这次对应Student里的getname方法*/
        String[] strings = list.stream().map(Student::getName).toArray(String[]::new);
        System.out.println(Arrays.toString(strings));
    }
}
